home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / apps / 93 / applic / sdb.doc < prev    next >
Text File  |  1987-01-15  |  25KB  |  863 lines

  1.  
  2.  
  3.                             SDB - a Simple Database System
  4.  
  5.                                     by David Betz
  6.                                  114 Davenport Avenue
  7.                                  Manchester, NH 03103
  8.                                 (603) 625-4691 (home)
  9.                                  (603) 623-1711 (BBS)
  10.  
  11.                                    January 17, 1986
  12.         SDB - a Simple Database System                                  Page 2
  13.  
  14.  
  15.         1  INTRODUCTION
  16.  
  17.         SDB is a simple database manager for small systems.  It was  developed
  18.         to  provide  a  relatively  low  overhead  system  for storing data on
  19.         machines with limited disk and memory resources.  The current  version
  20.         runs on the Atari ST.
  21.  
  22.         SDB was originally intended to be a  relational  database  system,  so
  23.         many  of the terms used in describing it are taken from the relational
  24.         database literature.  Within the context of SDB the  user  can  safely
  25.         make the following associations:
  26.  
  27.              1.  RELATION can be taken to mean FILE
  28.  
  29.              2.  TUPLE can be taken to mean RECORD
  30.  
  31.              3.  ATTRIBUTE can be taken to mean FIELD
  32.  
  33.         It should be noted that SDB is not a relationally complete system.  It
  34.         provides  the  relational operations of SELECT, PROJECT, and JOIN, but
  35.         does not  provide  the  set  operations  of  UNION,  INTERSECTION,  or
  36.         DIFFERENCE as well as some others.
  37.  
  38.  
  39.  
  40.         2  RELATION FILE FORMATS
  41.  
  42.         SDB maintains a separate file for each relation that the user creates.
  43.         This  file  contains  a  header block containing the definition of the
  44.         relation including the names  and  types  of  all  of  the  relation's
  45.         attributes.   The  remainder of the file contains fixed length records
  46.         each containing one tuple from the relation.
  47.  
  48.         Tuples can be of three types:
  49.  
  50.              1.  active - tuples that contain actual active data
  51.  
  52.              2.  deleted - tuples that have been deleted
  53.  
  54.              3.  unused - tuples that haven't been used yet
  55.  
  56.         Initially, all tuples are unused.  When a new tuple is stored  into  a
  57.         relation,  the first unused tuple is found (they are all contiguous at
  58.         the end of the relation file).  The new tuple is stored as  an  active
  59.         tuple.
  60.  
  61.         When a tuple is deleted, it is marked as such.  The  space  previously
  62.         allocated  to  the  deleted tuple is left unused until the relation is
  63.         compressed.
  64.  
  65.         It is possible that when attempting to store a new  tuple,  no  unused
  66.         tuple  can  be  found even though the relation contains fewer than the
  67.         maximum active tuples.  This happens when  tuples  have  been  deleted
  68.         since the time the relation file was last compressed.
  69.         SDB - a Simple Database System                                  Page 3
  70.  
  71.  
  72.         The compress function allows all of the space lost by deleting  tuples
  73.         to  be  regained.  It does this by copying all of the active tuples as
  74.         far backward in the file as possible  leaving  all  of  the  available
  75.         space toward the end of the file.
  76.  
  77.  
  78.  
  79.         3  SELECTION EXPRESSIONS
  80.  
  81.         A selection expression specifies a set of tuples over which  some  SDB
  82.         operation  is  to  be executed.  The syntax for a selection expression
  83.         is:
  84.  
  85.         <rse>           ::= <rnames> [ where <boolean> ]
  86.         <rnames>        ::= <rname> [ , <rname> ] ...
  87.         <rname>         ::= <relation-name> [ <alias> ]
  88.  
  89.         When a single relation name is specified in  a  selection  expression,
  90.         each tuple within that relation becomes a candidate for selection.
  91.  
  92.         When more than one relation name is specified, the tuples  are  formed
  93.         by taking the cross product of all specified relations.  If a relation
  94.         is to be crossed with itself, an alias must be given to one or both of
  95.         the  occurances  of  that  relation  name in the selection expression.
  96.         This allows SDB to determine which relation occurance is being refered
  97.         to in the boolean part of the selection expression.
  98.  
  99.         After  the  set  of  candidate  tuples  is  determined,  the   boolean
  100.         expression  is evaluated for each candidate.  The candidates for which
  101.         the boolean expression evaluates to TRUE become the selected tuples.
  102.  
  103.  
  104.  
  105.         4  INITIALIZATION FILE AND COMMAND FILES
  106.  
  107.         When SDB is first run, it attempts to read and process commands from a
  108.         file  named  "SDB.INI".  This file usually contains macro definitions,
  109.         but can contain any valid SDB command.  In addition, it is possible to
  110.         process  command files from within SDB.  This is done by typing an '@'
  111.         followed by the command file name after the SDB prompt.
  112.  
  113.  
  114.  
  115.         5  FILE NAMES
  116.  
  117.         Whenever a file name is allowed in the syntax for  a  command,  it  is
  118.         possible  to  use  either  an  identifier  or  a  quoted  string.   An
  119.         identifier is interpreted as the file name and a string is interpreted
  120.         as  a  full  file  specification.   The  string  form  allows  for the
  121.         specification of an alternate device or extension.
  122.         SDB - a Simple Database System                                  Page 4
  123.  
  124.  
  125.         6  FORM DEFINITION FILES
  126.  
  127.         A form definition file contains a template into which attribute values
  128.         are  substituted  during  a  print  operation.  There are two types of
  129.         information that can be included in a form definition:
  130.  
  131.              1.  Literal text
  132.  
  133.              2.  Attribute references
  134.  
  135.         Attribute  references  are  indicated  by  placing  the  name  of  the
  136.         attribute  being referenced between a pair of angle brackets.  Literal
  137.         text is anything that is not enclosed in angle brackets.
  138.  
  139.  
  140.         ________        Example:
  141.  
  142.         print using test amount,category from checks;
  143.  
  144.         Where test.frm contains:
  145.  
  146.         Amount: <amount>
  147.         Category: <category>
  148.         SDB - a Simple Database System                                  Page 5
  149.  
  150.  
  151.         7  ALIASES FOR RELATIONS AND ATTRIBUTES
  152.  
  153.         When a relation or attribute name is specified in a  print  statement,
  154.         it  is  possible  to  provide  an  alternate name for that relation or
  155.         attribute.  This is useful for relations, when it is necessary to join
  156.         a  relation to itself.  It is useful for attributes when it is desired
  157.         that the column headers in  a  table  be  different  from  the  actual
  158.         attribute  names.   Also,  alternate  attribute  names  can be used in
  159.         references to that attribute in the where clause as well as in a  form
  160.         definition file.  The syntax for specifying aliases is:
  161.  
  162.             <name> <alias>
  163.  
  164.  
  165.         ________        Example:
  166.  
  167.         print using test amount a,category c from checks;
  168.  
  169.         Where test.frm contains:
  170.  
  171.         Amount: <a>
  172.         Category: <c>
  173.         SDB - a Simple Database System                                  Page 6
  174.  
  175.  
  176.         8  BOOLEAN EXPRESSIONS
  177.  
  178.         The syntax for boolean expressions:
  179.  
  180.         <expr>          ::= <land> [ '|' <land> ]
  181.         <land>          ::= <relat> [ '&' <relat> ]
  182.         <relat>         ::= <primary> [ <relop> <primary> ]
  183.         <primary>       ::= <term> [ <addop> <term> ]
  184.         <term>          ::= <unary> [ <mulop> <unary> ]
  185.         <unary>         ::= <factor> | <unop> <unary>
  186.         <factor>        ::= <operand> | '(' <expr> ')'
  187.         <operand>       ::= <number> | <string> | <attribute>
  188.         <attribute>     ::= [ <rname> . ] <aname>
  189.         <relop>         ::= '=' | '<>' | '<' | '>' | '<=' | '>='
  190.         <addop>         ::= '+' | '-'
  191.         <mulop>         ::= '*' | '/'
  192.         <unop>          ::= '+' | '-' | '~'
  193.  
  194.         Operators:
  195.  
  196.              1.  '=' - equal
  197.  
  198.              2.  '<>' - not equal
  199.  
  200.              3.  '<' - less than
  201.  
  202.              4.  '>' - greater than
  203.  
  204.              5.  '<=' - less than or equal
  205.  
  206.              6.  '>=' - greater than or equal
  207.  
  208.              7.  '+' - addition or unary plus (not implemented)
  209.  
  210.              8.  '-' - subraction or unary minus (not implemented)
  211.  
  212.              9.  '*' - multiplication (not implemented)
  213.  
  214.             10.  '/' - division (not implemented)
  215.  
  216.             11.  '&' - logical and
  217.  
  218.             12.  '|' - logical or
  219.  
  220.             13.  '~' - logical not
  221.  
  222.         Operands:
  223.  
  224.              1.  number - a string of digits containing at  most  one  decimal
  225.                  point
  226.  
  227.              2.  string - a string of characters enclosed in double quotes
  228.         SDB - a Simple Database System                                  Page 7
  229.  
  230.  
  231.              3.  attribute - an  attribute  name  optionally  qualified  by  a
  232.                  relation name
  233.  
  234.         SDB - a Simple Database System                                  Page 8
  235.  
  236.  
  237.         9  INTERACTIVE COMMAND DESCRIPTIONS
  238.  
  239.         _________        Function:
  240.  
  241.         Create a relation file
  242.  
  243.  
  244.         _______        Format:
  245.  
  246.         create <rname> ( <alist> ) <isize> <esize>
  247.  
  248.  
  249.         ______        Rules:
  250.  
  251.              1.  <rname> is the name of the relation file
  252.  
  253.              2.  <alist> is a list of attribute definitions of the form:
  254.  
  255.                    <aname> { char | num } <size>
  256.  
  257.                  where:
  258.  
  259.                  1.  <aname> is the name of the attribute
  260.  
  261.                  2.  the type of the attribute is either "char" or "num"
  262.  
  263.                  3.  <size> is the number of bytes allocated to the  attribute
  264.                      value
  265.  
  266.  
  267.              3.  <isize> is the initial size of the relation in tuples
  268.  
  269.              4.  <esize> is the number of tuples to expand by
  270.  
  271.  
  272.  
  273.  
  274.         ________        Example:
  275.  
  276.         create checks (
  277.             number      num     4
  278.             date        char    8
  279.             payee       char    20
  280.             amount      num     8
  281.             category    char    5
  282.         ) 200 100
  283.  
  284.         This  command  creates  a  relation  file  named   "checks.sdb"   with
  285.         attributes  "number",  "date",  "payee",  "amount", and "category" and
  286.         space to store 200 tuples.  When the relation is full (200 tuples have
  287.         been stored) it is extended by 100 tuples on the next store operation.
  288.         SDB - a Simple Database System                                  Page 9
  289.  
  290.  
  291.         _________        Function:
  292.  
  293.         Insert tuples into a relation
  294.  
  295.  
  296.         _______        Format:
  297.  
  298.         insert <rname>
  299.  
  300.  
  301.         ______        Rules:
  302.  
  303.              1.  <rname> is the name of a relation
  304.  
  305.              2.  the user will be prompted for the values  of  the  attributes
  306.                  for the tuple to be inserted
  307.  
  308.              3.  a null response to an attribute prompt will  terminate  tuple
  309.                  entry
  310.  
  311.              4.  if a null value is desired, a single space can be entered
  312.  
  313.         SDB - a Simple Database System                                 Page 10
  314.  
  315.  
  316.         _________        Function:
  317.  
  318.         Delete tuples from a set of relations
  319.  
  320.  
  321.         _______        Format:
  322.  
  323.         delete <rse> ;
  324.  
  325.  
  326.         ______        Rules:
  327.  
  328.              1.  <rse> is a tuple selection expression
  329.  
  330.              2.  selected tuples are deleted
  331.  
  332.  
  333.  
  334.         ________        Example:
  335.  
  336.         delete checks where category = "junk";
  337.         SDB - a Simple Database System                                 Page 11
  338.  
  339.  
  340.         _________        Function:
  341.  
  342.         Update the values of selected attributes in selected tuples
  343.  
  344.  
  345.         _______        Format:
  346.  
  347.         update { <attrs> | * } from <rse> ;
  348.  
  349.  
  350.         ______        Rules:
  351.  
  352.              1.  <attrs> is a list of attribute names to be updated
  353.  
  354.              2.  * means all attributes
  355.  
  356.              3.  <rse> is a tuple selection expression
  357.  
  358.              4.  for each set of selected tuples, the user is prompted for new
  359.                  values for the selected attributes
  360.  
  361.              5.  a null response  to  an  attribute  prompt  will  retain  the
  362.                  previous attribute value
  363.  
  364.              6.  if a null value is desired, a single space can be entered
  365.  
  366.  
  367.  
  368.         ________        Example:
  369.  
  370.         update amount,category from checks where number > 10;
  371.         SDB - a Simple Database System                                 Page 12
  372.  
  373.  
  374.         _________        Function:
  375.  
  376.         Print a table of values of selected attributes
  377.  
  378.  
  379.         _______        Format:
  380.  
  381.         print [ using <fname> ] { <attrs> | * } from <rse> [ into <fname> ] ;
  382.  
  383.  
  384.         ______        Rules:
  385.  
  386.              1.  using <fname> indicates output using a form  definition  file
  387.                  (.FRM)
  388.  
  389.              2.  <attrs> is a list of attribute names to be printed
  390.  
  391.              3.  * means all attributes
  392.  
  393.              4.  <rse> is a tuple selection expression
  394.  
  395.              5.  <fname> is the name of an file to which  the  table  will  be
  396.                  output (.TXT)
  397.  
  398.              6.  if the output file name is omitted, output is to the terminal
  399.  
  400.              7.  for each set of selected tuples, a  table  entry  is  printed
  401.                  containing the selected attributes
  402.  
  403.  
  404.  
  405.         ________        Example:
  406.  
  407.         print payee,amount from checks where category = "junk";
  408.         SDB - a Simple Database System                                 Page 13
  409.  
  410.  
  411.         _________        Function:
  412.  
  413.         Import tuples from a file into a relation
  414.  
  415.  
  416.         _______        Format:
  417.  
  418.         import <fname> into <rname>
  419.  
  420.  
  421.         ______        Rules:
  422.  
  423.              1.  <fname> is the name of the input file (.DAT)
  424.  
  425.              2.  the input file contains the values of  the  tuple  attributes
  426.                  with each on a separate line
  427.  
  428.              3.  <rname> is the name of a relation
  429.  
  430.              4.  tuples are appended to the named relation
  431.  
  432.         SDB - a Simple Database System                                 Page 14
  433.  
  434.  
  435.         _________        Function:
  436.  
  437.         Export tuples from a relation into a file
  438.  
  439.  
  440.         _______        Format:
  441.  
  442.         export <rname> [ into <fname> ] ;
  443.  
  444.  
  445.         ______        Rules:
  446.  
  447.              1.  <rname> is the name of a relation
  448.  
  449.              2.  <fname> is the name of the output file (.DAT)
  450.  
  451.              3.  if the output file name is omitted, output is to the terminal
  452.  
  453.              4.  tuples are written to the  output  file  with  one  attribute
  454.                  value per line
  455.  
  456.         SDB - a Simple Database System                                 Page 15
  457.  
  458.  
  459.         _________        Function:
  460.  
  461.         Extract the definition of a relation into a file
  462.  
  463.  
  464.         _______        Format:
  465.  
  466.         extract <rname> [ into <fname> ] ;
  467.  
  468.  
  469.         ______        Rules:
  470.  
  471.              1.  <rname> is the name of a relation
  472.  
  473.              2.  <fname> is the name of the output file (.DEF)
  474.  
  475.              3.  if the output file name is omitted, output is to the terminal
  476.  
  477.              4.  the definition of the relation is written to the output file
  478.  
  479.         SDB - a Simple Database System                                 Page 16
  480.  
  481.  
  482.         _________        Function:
  483.  
  484.         Compress a relation file
  485.  
  486.  
  487.         _______        Format:
  488.  
  489.         compress <rname>
  490.  
  491.  
  492.         ______        Rules:
  493.  
  494.              1.  <rname> is the name of a relation file
  495.  
  496.              2.  tuples are copied toward the front of the relation file  such
  497.                  that  any  space  freed  by previously deleted tuples becomes
  498.                  adjacent to the free space at  the  end  of  the  file,  thus
  499.                  becoming available for use in inserting new tuples
  500.  
  501.         SDB - a Simple Database System                                 Page 17
  502.  
  503.  
  504.         _________        Function:
  505.  
  506.         Sort a relation file
  507.  
  508.  
  509.         _______        Format:
  510.  
  511.         sort <rname> by <sname> { , <sname } ...  ;
  512.  
  513.  
  514.         ______        Rules:
  515.  
  516.              1.  <rname> is the name of a relation file
  517.  
  518.              2.  <sname> is the name of  an  attribute  to  sort  on  followed
  519.                  optionally by "ascending" or "descending"
  520.  
  521.              3.  if a sort order is not specified, ascending is assumed
  522.  
  523.              4.  tuples within the relation are  sorted  in  place  using  the
  524.                  attributes indicated
  525.  
  526.         SDB - a Simple Database System                                 Page 18
  527.  
  528.  
  529.         _________        Function:
  530.  
  531.         Define a macro
  532.  
  533.  
  534.         _______        Format:
  535.  
  536.         define <mname>
  537.  
  538.  
  539.         ______        Rules:
  540.  
  541.              1.  <mname> is the name of the macro being defined
  542.  
  543.              2.  if a macro with the specified  name  already  exists,  it  is
  544.                  replaced
  545.  
  546.              3.  after entering the define command, definition mode is entered
  547.  
  548.              4.  definition mode is indicated by the prompt "SDB-DEF>"
  549.  
  550.              5.  all lines typed in definition mode are  added  to  the  macro
  551.                  definition
  552.  
  553.              6.  a blank line terminates definition mode
  554.  
  555.              7.  a macro can be deleted by entering a blank line as  the  only
  556.                  line in the definition
  557.  
  558.              8.  after a macro is defined, every occurance of the  macro  name
  559.                  is replaced by the macro definition
  560.  
  561.         SDB - a Simple Database System                                 Page 19
  562.  
  563.  
  564.         _________        Function:
  565.  
  566.         Show a macro definition
  567.  
  568.  
  569.         _______        Format:
  570.  
  571.         show <mname>
  572.  
  573.  
  574.         ______        Rules:
  575.  
  576.              1.  <mname> is the name of a macro  whose  definition  is  to  be
  577.                  shown
  578.  
  579.         SDB - a Simple Database System                                 Page 20
  580.  
  581.  
  582.         _________        Function:
  583.  
  584.         Print a short help message
  585.  
  586.  
  587.         _______        Format:
  588.  
  589.         help
  590.  
  591.  
  592.         ______        Rules:
  593.  
  594.              1.  (none)
  595.  
  596.         SDB - a Simple Database System                                 Page 21
  597.  
  598.  
  599.         _________        Function:
  600.  
  601.         Exit from SDB
  602.  
  603.  
  604.         _______        Format:
  605.  
  606.         exit
  607.  
  608.  
  609.         ______        Rules:
  610.  
  611.              1.  (none)
  612.  
  613.         SDB - a Simple Database System                                 Page 22
  614.  
  615.  
  616.         10  PROGRAM INTERFACE
  617.  
  618.         SDB provides a callable program interface to allow programs written in
  619.         C  to  access relation files.  In order to use the call interface, the
  620.         users program should be linked with  the  SDBUSR.OBJ  object  library.
  621.         Also,  additional  stack  space should be allocated at link time using
  622.         the /BOTTOM qualifier on the link command.  /BOTTOM:3000 seems to work
  623.         well, but it is probably possible to get away with less.
  624.  
  625.         ________        Example:
  626.  
  627.         #include <stdio.h>
  628.         #include "sdb.h"
  629.  
  630.         main()
  631.         {
  632.             DB_SEL *sptr;
  633.             char payee[100],amount[100];
  634.  
  635.             /* setup retrieval */
  636.             if ((sptr = db_retrieve("checks where amount > 25.00")) == NULL) {
  637.                 printf("*** error: %s ***\n",db_ertxt(dbv_errcode));
  638.                 exit();
  639.             }
  640.  
  641.             /* bind user variables to attributes */
  642.             db_bind(sptr,"checks","payee",payee);
  643.             db_bind(sptr,"checks","amount",amount);
  644.  
  645.             /* loop through selection */
  646.             while (db_fetch(sptr))
  647.                 printf("%s\t%s\n",payee,amount);
  648.  
  649.             /* finish selection */
  650.             db_done(sptr);
  651.         }
  652.         SDB - a Simple Database System                                 Page 23
  653.  
  654.  
  655.         _________        Function:
  656.  
  657.         Setup a tuple retrieval context
  658.  
  659.  
  660.         _______        Format:
  661.  
  662.         dbptr = db_retrieve(sexpr [ ,arg ]...)
  663.  
  664.  
  665.         ______        Rules:
  666.  
  667.              1.  sexpr is a pointer to a string containing an rse
  668.  
  669.              2.  arg is a "printf" argument
  670.  
  671.              3.  dbptr is a database context pointer
  672.  
  673.              4.  db_retrieve returns NULL on errors
  674.  
  675.              5.  on errors, the error code is in dbv_errcode
  676.  
  677.         SDB - a Simple Database System                                 Page 24
  678.  
  679.  
  680.         _________        Function:
  681.  
  682.         Fetch the next set of tuples from a retrieval context
  683.  
  684.  
  685.         _______        Format:
  686.  
  687.         db_fetch(dbptr)
  688.  
  689.  
  690.         ______        Rules:
  691.  
  692.              1.  dbptr is a database context pointer
  693.  
  694.              2.  updates the values of all bound user variables
  695.  
  696.              3.  db_fetch returns FALSE if no more tuples match or if an error
  697.                  occurs
  698.  
  699.              4.  on errors, the error code is in dbv_errcode
  700.  
  701.         SDB - a Simple Database System                                 Page 25
  702.  
  703.  
  704.         _________        Function:
  705.  
  706.         Update the current tuple within a retrieval context
  707.  
  708.  
  709.         _______        Format:
  710.  
  711.         db_update(dbptr)
  712.  
  713.  
  714.         ______        Rules:
  715.  
  716.              1.  dbptr is a database context pointer
  717.  
  718.              2.  db_update returns FALSE if an error occurs
  719.  
  720.              3.  on errors, the error code is in dbv_errcode
  721.  
  722.         SDB - a Simple Database System                                 Page 26
  723.  
  724.  
  725.         _________        Function:
  726.  
  727.         Store a new tuple within a retrieval context
  728.  
  729.  
  730.         _______        Format:
  731.  
  732.         db_store(dbptr)
  733.  
  734.  
  735.         ______        Rules:
  736.  
  737.              1.  dbptr is a database context pointer
  738.  
  739.              2.  db_store returns FALSE if an error occurs
  740.  
  741.              3.  on errors, the error code is in dbv_errcode
  742.  
  743.         SDB - a Simple Database System                                 Page 27
  744.  
  745.  
  746.         _________        Function:
  747.  
  748.         Bind a user variable to the  value  of  a  tuple  attribute  within  a
  749.         retrieval context
  750.  
  751.  
  752.         _______        Format:
  753.  
  754.         db_bind(dbptr,rname,aname,value)
  755.  
  756.  
  757.         ______        Rules:
  758.  
  759.              1.  dbptr is a database context pointer
  760.  
  761.              2.  rname is a pointer to the relation name
  762.  
  763.              3.  aname is a pointer to the attribute name
  764.  
  765.              4.  value is a pointer  to  a  character  array  to  receive  the
  766.                  attribute value
  767.  
  768.              5.  db_bind returns FALSE if an error occurs
  769.  
  770.              6.  on errors, the error code is in dbv_errcode
  771.  
  772.         SDB - a Simple Database System                                 Page 28
  773.  
  774.  
  775.         _________        Function:
  776.  
  777.         Get the value of a tuple attribute within a retrieval context
  778.  
  779.  
  780.         _______        Format:
  781.  
  782.         db_get(dbptr,rname,aname,value)
  783.  
  784.  
  785.         ______        Rules:
  786.  
  787.              1.  dbptr is a database context pointer
  788.  
  789.              2.  rname is a pointer to the relation name
  790.  
  791.              3.  aname is a pointer to the attribute name
  792.  
  793.              4.  value is a pointer  to  a  character  array  to  receive  the
  794.                  attribute value
  795.  
  796.              5.  db_get returns FALSE if an error occurs
  797.  
  798.              6.  on errors, the error code is in dbv_errcode
  799.  
  800.         SDB - a Simple Database System                                 Page 29
  801.  
  802.  
  803.         _________        Function:
  804.  
  805.         Put the value of a tuple attribute within a retrieval context
  806.  
  807.  
  808.         _______        Format:
  809.  
  810.         db_put(dbptr,rname,aname,value)
  811.  
  812.  
  813.         ______        Rules:
  814.  
  815.              1.  dbptr is a database context pointer
  816.  
  817.              2.  rname is a pointer to the relation name
  818.  
  819.              3.  aname is a pointer to the attribute name
  820.  
  821.              4.  value is a pointer to the new value
  822.  
  823.              5.  db_put returns FALSE if an error occurs
  824.  
  825.              6.  on errors, the error code is in dbv_errcode
  826.  
  827.         SDB - a Simple Database System                                 Page 30
  828.  
  829.  
  830.         _________        Function:
  831.  
  832.         Discontinue usage of a retrieval context
  833.  
  834.  
  835.         _______        Format:
  836.  
  837.         db_done(dbptr)
  838.  
  839.  
  840.         ______        Rules:
  841.  
  842.              1.  dbptr is a database context pointer
  843.  
  844.         SDB - a Simple Database System                                 Page 31
  845.  
  846.  
  847.         _________        Function:
  848.  
  849.         Translate an error code to an error message text
  850.  
  851.  
  852.         _______        Format:
  853.  
  854.         db_ertxt(errcode)
  855.  
  856.  
  857.         ______        Rules:
  858.  
  859.              1.  errcode is an SDB error code
  860.  
  861.              2.  db_ertxt returns a pointer to the error message text
  862.  
  863.